<?php


namespace app\api\controller\v1;


use app\api\service\UserToken;
use app\validate\api\TokenGet;
use think\annotation\Route;
use think\Exception;

class Token
{
    /**
     * @param string $code
     * @Route("v1/token/user",method="POST",https=0)
     *
     *
     *
     * @return false|string
     * @throws Exception
     */
    public function getToken($code='')
    {
        (new TokenGet())->goCheck();
        $ut = new UserToken($code);
        $token = $ut->get();
        $result =  ['token'=>$token];
        return json($result);
    }
}